#include <stdio.h>
#include <math.h>

int main(int argc, char **argv){
    //计算大于lgN的最小整数
    //方法一：
    int i;
    int N = 33;
    int temp = N;
    for (i = 0; temp > 0;i++) {
        temp = temp / 2;
    }
    printf("The smallest integet greater than lg %d is %d\n", N, i);

    //方法二：
    int j;
    int t = 1;
    for (j = 0; t < N; j++) {
        t += t;
    }
    printf("The smallest integet greater than lg %d is %d\n", N , j);

    //计算向上取整函数、计算向下取整函数
    int floor = N/2;
    int ceil = N-N/2;

    printf("floor(%d)=%d, ceil(%d)=%d\n", N, floor, N, ceil);


    //计算第N个调和数
    double r = 0.57221;
    double h_n = log(N)+r+1/(12*N);

    printf("h_n=%f\n", h_n);

    return 0;
}